Skip to content

fix(test): provide experimental config in Cloudflare session-false test - #17606

Merged
matthewp merged 1 commit into
withastro:mainfrom
adamchal:fix/cloudflare-session-false-test-config
Aug 5, 2026
Merged

matthewp merged 1 commit into
withastro:mainfrom
adamchal:fix/cloudflare-session-false-test-config

Conversation

@adamchal

@adamchal adamchal commented Aug 5, 2026

Copy link
Copy Markdown
Member

Changes

Fixes the three @astrojs/cloudflare session-false tests failing on main and blocking #17558.

The adapter's astro:config:setup gained an unguarded read of config.experimental.collectionStorage in #17543 (src/index.ts:289). session-false.test.ts calls that hook with a mock config that has no experimental key, so it threw TypeError: Cannot read properties of undefined (reading 'collectionStorage'). This PR adds the missing key to the mock:

experimental: { collectionStorage: 'single-file' },

A resolved AstroConfig always has it, since the schema defaults it to 'single-file', so the mock was incomplete rather than the adapter.

Testing

  • Fixed the failing Cloudflare tests.
  • Node and Netlify are unaffected since their mocks don't read experimental.

Docs

None needed, test-only change. No changeset for the same reason.

The Cloudflare adapter's `astro:config:setup` reads
`config.experimental.collectionStorage` (added in withastro#17543). The mock config
in this test omitted `experimental` entirely, so the hook threw
`TypeError: Cannot read properties of undefined (reading 'collectionStorage')`.

A resolved `AstroConfig` always has this key populated, since the schema
defaults it to `'single-file'`, so the mock was the incomplete party rather
than the adapter. Set it explicitly to match a real config.

This surfaced only after withastro#16871 and withastro#17543 landed together: this PR's checks
last ran before withastro#17543 merged, so neither PR's CI ever exercised the
combination.
@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2b2c41d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the pkg: integration Related to any renderer integration (scope) label Aug 5, 2026
@adamchal

adamchal commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

One alternative, if you'd rather the adapter tolerate partial configs than fix the mock. The read is here:

...(config.experimental.collectionStorage === 'chunked' && {

Making that config.experimental?.collectionStorage also clears all three failures, and it's the only unguarded experimental access in the file.

I went with the test instead because a resolved AstroConfig always has that key populated, since the schema defaults it to 'single-file'.

@matthewp
matthewp merged commit a2240c4 into withastro:main Aug 5, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants